From d731ce49ad852ce3331f6a1a757b21a570599791 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 3 Apr 2021 22:00:48 -0400 Subject: [PATCH] textbtree: Don't opencode realloc We can just use g_realloc here. --- gtk/gtktextbtree.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c index 19189affc6..bfe628cf77 100644 --- a/gtk/gtktextbtree.c +++ b/gtk/gtktextbtree.c @@ -6496,21 +6496,9 @@ inc_count (GtkTextTag *tag, int inc, TagInfo *tagInfoPtr) if (tagInfoPtr->numTags == tagInfoPtr->arraySize) { - GtkTextTag **newTags; - int *newCounts, newSize; - - newSize = 2*tagInfoPtr->arraySize; - newTags = (GtkTextTag **) g_malloc ((unsigned) - (newSize*sizeof (GtkTextTag *))); - memcpy ((void *) newTags, (void *) tagInfoPtr->tags, - tagInfoPtr->arraySize *sizeof (GtkTextTag *)); - g_free ((char *) tagInfoPtr->tags); - tagInfoPtr->tags = newTags; - newCounts = (int *) g_malloc ((unsigned) (newSize*sizeof (int))); - memcpy ((void *) newCounts, (void *) tagInfoPtr->counts, - tagInfoPtr->arraySize *sizeof (int)); - g_free ((char *) tagInfoPtr->counts); - tagInfoPtr->counts = newCounts; + int newSize = 2 * tagInfoPtr->arraySize; + tagInfoPtr->tags = g_realloc (tagInfoPtr->tags, newSize * sizeof (GtkTextTag *)); + tagInfoPtr->counts = g_realloc (tagInfoPtr->counts, newSize * sizeof (int)); tagInfoPtr->arraySize = newSize; } -- 2.30.2